package top.lshaci.learning.netty.rpc.comsumer;

import top.lshaci.learning.netty.rpc.common.HelloService;

import java.util.concurrent.TimeUnit;

/**
 * ClientBootstrap
 *
 * @author lshaci
 * @since 1.0.0
 */
public class ClientBootstrap {
    /**
     * 这里定义协议头
     */
    public static final String providerName = "HelloService#hello#";

    public static void main(String[] args) throws InterruptedException {
        NettyClient customer = new NettyClient();

         HelloService helloService = (HelloService) customer.getBean(HelloService.class, providerName);
         for(;;) {
             TimeUnit.SECONDS.sleep(5);
             String result = helloService.hello("你好 RPC");
             System.err.println("收到的结果为：" + result);
         }
    }
}
